<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
   <input type="text" id="txt">
   <button id="btn">搜索</button>

   <table width="500" border="1" style="border-collapse: collapse">
       <thead>
           <th>姓名</th>
           <th>年龄</th>
           <th>操作</th>
       </thead>
       <tbody>
          <tr>
              <td>张三</td>
              <td>18</td>
              <td>
                  <a >删除</a>
              </td>
          </tr>
          <tr>
              <td>张四</td>
              <td>20</td>
              <td>
                  <a >删除</a>
              </td>
          </tr>
          <tr>
              <td>李四</td>
              <td>19</td>
              <td>
                  <a >删除</a>
              </td>
          </tr>
          <tr>
              <td>王五</td>
              <td>20</td>
              <td>
                  <a >删除</a>
              </td>
          </tr>
          <tr>
              <td>Bucky</td>
              <td>19</td>
              <td>
                  <a >删除</a>
              </td>
          </tr>
       </tbody>
   </table>
   <script type="text/javascript">
       var oTable = document.getElementsByTagName('table')[0];
       var oTxt = document.getElementById('txt');
       var oBtn = document.getElementById('btn');

       var aRows = oTable.tBodies[0].rows;


       oBtn.onclick = function () {

           for(var i=0;i<aRows.length;i++){
               var sTab = aRows[i].cells[0].innerHTML.toLowerCase();
               var sTxt = oTxt['value'].toLowerCase();

               var aTxt = sTxt.split('');

               for(var j=0;j<aTxt.length;j++){
                   if (sTab.search(aTxt[j])!=-1){

                       aRows[i].style.background='red';
                   }
                   else {
                       aRows[i].style.background='';
                   }
               }
           }
       }




   </script>
</body>
</html>